# -*- coding:utf-8 -*-
#python 2.7



from bs4 import BeautifulSoup
import requests
from questiondb import qudb

def getFile(file_name):
    with open(file_name) as f:
        html=f.read()
    return html


html=getFile("s1.html")
soup = BeautifulSoup(html, 'html.parser')   #文档对象

questions=[]

for k in soup.find_all('div',class_='div_title_question'):#,string='更多'
    questions.append([k['id'][len('divTitle'):],k.contents[0]]) #[0][-len('<span class="req"> *</span>')])


j=1
qu_db=qudb()
for q in questions[5:]:
    q=q[1]

    print j,q,":",qu_db.GetAnswerByQuestion(q)
    j=j+1